import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class CommonDialogUtil {
  ///底部弹出
  static void showBottomSheet(
    BuildContext context,
    Widget child, {
    BoxConstraints? constraints,
  }) {
    showModalBottomSheet(
      context: context,
      isScrollControlled: true,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.vertical(
          top: Radius.circular(12.w),
        ),
      ),
      builder: (context) {
        return Container(
          constraints: constraints ??
              BoxConstraints(
                minHeight: 200.w, //设置最小高度（必要）
                maxHeight: 240.w + ScreenUtil().bottomBarHeight, //设置最大高度（必要）
              ),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.vertical(
              top: Radius.circular(12.w),
            ),
            color: Colors.white,
          ),
          child: child,
        );
      },
    );
  }
}
